import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  scrollBehavior() {
    // 始终滚动到顶部
    return { top: 0 };
  },
  routes: [
    {
      path: "/",
      name: "movie",
      component: () => import("../views/moviePage.vue"),
      redirect: "/movie/movieLeft",
      children: [
        {
          path: "/movie/movieLeft",
          name: "movieLeft",
          component: () => import("../views/movieTop/movieTopL.vue"),
        },
        {
          path: "/movie/movieRight",
          name: "movieRight",
          component: () => import("../views/movieTop/movieTopR.vue"),
        },
      ],
    },
    {
      path: "/cirema",
      name: "cirema",
      component: () => import("../views/ciremaPage.vue"),
      redirect: "/cirema/home",

      children: [
        {
          path: "/cirema/app",
          name: "app",
          component: () => import("../views/cinema/appPage.vue"),
        },
        {
          path: "/cirema/front",
          name: "front",
          component: () => import("../views/cinema/frontExchange.vue"),
        },
        {
          path: "/cirema/went",
          name: "went",
          component: () => import("../views/cinema/recentWent.vue"),
        },
        {
          path: "/cirema/near",
          name: "near",
          component: () => import("../views/cinema/nearMe.vue"),
        },
        {
          path: "/cirema/home",
          name: "home",
          component: () => import("../views/cinema/homePage.vue"),
        },
      ],
    },
    {
      path: "/selectCity",
      name: "selectCity",
      component: () => import("../views/cinema/leftBj.vue"),
    },
    {
      path: "/rightSearch",
      name: "rightSearch",
      component: () => import("../views/cinema/rightSearch.vue"),
    },
    {
      path: "/news",
      name: "news",
      component: () => import("../views/newsPage.vue"),
    },
    {
      path: "/my",
      name: "my",
      component: () => import("../views/myPage.vue"),
    },
    {
      path: "/detail",
      name: "detail",
      component: () => import("../views/movieDetail/movieDetail.vue"),
    },
    {
      path: "/login",
      name: "login",
      component: () => import("../views/my/loginPage.vue"),
    },
    {
      path: "/:pathMatch(.*)*",
      name: "notFound",
      component: () => import("../views/notFound.vue"),
    },
  ],
});

export default router;
